package com.jp.aop;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * Title: Main
 * Description:
 *
 * @author zifan_jp
 * @version 1.0
 * @since Date: 2019-11-15 15:59
 * Copyright: Copyright (c) zifan_jp
 * ModificationHistory   Who    When    What
 * -----------------------------------------------
 */

@ComponentScan
@EnableAspectJAutoProxy
@Configuration
public class Main {


    public  static  void test1(AnnotationConfigApplicationContext app){
        CompactDisc compactDisc = app.getBean(CompactDisc.class);
        compactDisc.playTrack(0,0);
        compactDisc.playTrack(0,1);
        compactDisc.playTrack(1,1);
        System.out.println(app.getBean(TrackCounter.class).getPlayCount(0));
    }


    public  static  void test(AnnotationConfigApplicationContext app){

    }


    public static void main(String[] args) {
        AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(Main.class);
        Performance performance = app.getBean(Performance.class);
        performance.perform();
        Encoreable encoreable = (Encoreable)performance;
        encoreable.performEncore();
    }
}
